package solitaire.presentation;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;

import solitaire.controle.CSolitaire;

public class PSolitaire extends JPanel{
	
	CSolitaire controleur;
	
	public PSolitaire(CSolitaire controleur) {
		this.controleur = controleur;

		setSize(300, 400);
		setOpaque(true);
	}
	
	public CSolitaire getControleur() {
		return controleur;
	}

	public void setControleur(CSolitaire controleur) {
		this.controleur = controleur;
	}

	public void initialiser(PSabot sabot, PColonne[] colonnes, PTasDeCartesColorees[] tasCarteColorees) {
        //sabot.setPos(0, 0, 30, 0);
        //this.removeAll();
        this.setLayout(new BorderLayout());
        this.add(sabot, BorderLayout.NORTH);
        this.add(this.makeColonnesBox(colonnes, tasCarteColorees), BorderLayout.CENTER);
        this.validate();
	}
	
	public JPanel makeColonnesBox(PColonne[] colonnes, PTasDeCartesColorees[] tasCarteColorees) {
		JPanel container = new JPanel();
		
		container.setLayout(new FlowLayout(FlowLayout.LEFT));
		
		for (int i = 0; i < colonnes.length; i++) {
			container.add(colonnes[i]);
		}		
		
		container.validate();
		container.setVisible(true);
		return container;
	}
}
